# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-applications
pkgname=dolphin
pkgver=23.08.4
pkgrel=0
# armhf blocked by extra-cmake-modules
arch="all !armhf"
url="https://kde.org/applications/system/dolphin"
pkgdesc="KDE File Manager"
license="GPL-2.0-only"
depends="
	udisks2
	kio-extras
	"
depends_dev="
	baloo5-dev
	baloo-widgets-dev
	kactivities5-dev
	kbookmarks5-dev
	kcmutils5-dev
	kcompletion5-dev
	kconfig5-dev
	kcoreaddons5-dev
	kcrash5-dev
	kdbusaddons5-dev
	kdoctools5-dev
	kfilemetadata5-dev
	ki18n5-dev
	kiconthemes5-dev
	kinit5-dev
	kio5-dev
	knewstuff5-dev
	knotifications5-dev
	kparts5-dev
	ktextwidgets5-dev
	kuserfeedback-dev
	kwindowsystem5-dev
	musl-fts-dev
	phonon-dev
	qt5-qtbase-dev
	solid5-dev
	"
makedepends="$depends_dev
	extra-cmake-modules
	ruby-test-unit
	samurai
	"
checkdepends="
	xvfb-run
	dbus
	"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang $pkgname-zsh-completion"
_repo_url="https://invent.kde.org/system/dolphin.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/dolphin-$pkgver.tar.xz
	0001-Fix-musl-build-by-using-fts-from-external-library.patch
	"

build() {
	LDFLAGS="$LDFLAGS -Wl,-z,stack-size=0x100000" \
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	# kfileitemmodeltest, placesitemmodeltest, dolphinmainwindowtest and kitemlistcontrollertest are broken
	xvfb-run ctest --test-dir build --output-on-failure -E "(kfileitemmodel|placesitemmodel|dolphinmainwindow|kitemlistcontroller)test"
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	# We don't ship systemd
	rm -r "$pkgdir"/usr/lib/systemd
}

sha512sums="
f0e7af7a066f71b155292d7a49ff217f89be5f062629e67ed9a43ce3ed77cbb09b3b037de71bea7d21fc97732c0545fda3530e5eabed54a581384792d3195db9  dolphin-23.08.4.tar.xz
5b3a1095d519a2d2e875e4dc468f170fd19515963ad4946268533053785b0b3beee57ee9f8d0650de5cb5534dcc948f61327fd836908371cfccf279eea296915  0001-Fix-musl-build-by-using-fts-from-external-library.patch
"
